#include "types.h"

//console.c
void consoleinit(void);
void consputc(int c);
void consolewrite(const char *buf, int len);

//uart.c
void uartinit(void);
void uart_putc(char c);
void uart_puts(const char *s, int len);
int uart_getc(void);
void writeb(uint64 addr, uint8 value);
uint8 readb(uint64 addr);

//printf.c
int printf(const char *fmt, ...);
void printint(long long xx, int base, int sign);
void printptr(uint64 x);
int puts(const char* str);
int putchar(int c);

//kalloc.c
void kinit();
void kfree(void* p);
void* kalloc(void);

//vm.c
pagetable_t create_pagetable(void);
void kvminit();
void kvminithart();
int map_page(pagetable_t pagetable, uint64 va, uint64 pa, int perm);
uint64 walkaddr(pagetable_t pagetable, uint64 va);
pte_t* walk(pagetable_t pagetable, uint64 va, int alloc);
void unmap_pages(pagetable_t pagetable, uint64 va, uint64 npages, int do_free);
uint64 decline_pagetable(pagetable_t pagetable, uint64 oldsz, uint64 newsz);
uint64 grow_pagetable(pagetable_t pagetable, uint64 oldsz, uint64 newsz);
void freewalk(pagetable_t pagetable);
void free_user_pages(pagetable_t pagetable, uint64 sz);


//string.c
void memset(void* add, int c, uint64 n);